package api_.collectionTest;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class CollectionTest
{
    public static void main(String[] args)
    {
        Collection collection = new ArrayList();
        collection.add(1);
        collection.add(2);
        collection.add("String");
        collection.add("123");
        System.out.println(collection);


        Collection<Integer> collection1 = new ArrayList();
        collection1.add(1);
        collection1.add(2);
//        collection1.add("S");


        Collection<String> collection2 = new ArrayList<>();
        collection2.add("11");
        collection2.add("2");
        collection2.add("33");

        int collectionSize = collection.size();
        int collection1Size = collection1.size();
        int collectionSize2 = collection2.size();
        System.out.println("collectionSize = " + collectionSize  + " collectioSize1 =  " + collection1Size + " collectionSize2 = " + collectionSize2);
        Iterator iterator = collection.iterator();
        while (iterator.hasNext())
        {
            Object o = iterator.next();
            System.out.println(o );
        }


    }

}
